From c15e163eb1e6df8738121e8ca48bcfe38d920ac4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Florian=20M=C3=BCllner?= Date: Fri, 2 Mar 2018 23:31:36 +0100 Subject: [PATCH] network: Handle networks with no access points This avoids a couple of warnings when encountering such a network. https://gitlab.gnome.org/GNOME/gnome-shell/issues/76 --- js/ui/status/network.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/ui/status/network.js b/js/ui/status/network.js index a75993612..a71297eed 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -995,8 +995,16 @@ var NMWirelessDialog = new Lang.Class({ else if (!oneHasConnection && twoHasConnection) return 1; - let oneStrength = one.accessPoints[0].strength; - let twoStrength = two.accessPoints[0].strength; + let oneAp = one.accessPoints[0] || null; + let twoAp = two.accessPoints[0] || null; + + if (oneAp != null && twoAp == null) + return -1; + else if (oneAp == null && twoAp != null) + return 1; + + let oneStrength = oneAp.strength; + let twoStrength = twoAp.strength; // place stronger connections first if (oneStrength != twoStrength) -- 2.39.5